#pragma once

#include <QMenuBar>
#include <QToolBar>
#include <QMainWindow>
#include <QTimer>
#include <QScriptValue>

namespace util {

class QtHelper : public QObject
{
  Q_OBJECT

public:
  QtHelper(QObject * pParent_ = NULL);

public slots:
  QPoint Point(int x, int y) { return QPoint(x, y); }
  QSize  Size(int w, int h) { return QSize(w, h); }

  QObject * MakeTimer() { return new QTimer; }

  void SetIconSize(int W_, int H_);
  QObject * MakeMenuBar(QMainWindow * pParent_, const QString & ID_);
  QObject * MakeToolBar(QMainWindow * pParent_, const QString & ID_, const QString & Title_);
  QObject * AddMenu(QWidget * pWidget_, const QString & ID_, const QString & Title_);
  void AddActions(QWidget * pWidget_, const QObjectList &Actions_);
  void MessageBoxAbout(QWidget *pParent_, const QString & Title_, const QString & Text_);

  void GetOpenFileName(QWidget * pParent_, const QString & Caption_, const QString & Dir_, const QStringList & Filter_, QScriptValue ret);

private:
  QSize mIconSize;
};

}